package com.xiaoshuidi.cloud.module.rooms.convert.reservation;

import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.reservation.vo.*;
import com.xiaoshuidi.cloud.module.rooms.controller.app.reserve.vo.ReceiptPageRespVO;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomHouseReserve;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomReceipt;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author Feng
 * @date 2023/5/20
 */
@Mapper
public interface ReservationConvert {


    ReservationConvert INSTANCE = Mappers.getMapper(ReservationConvert.class);

    RoomHouseReserve convert(ReserveCreateReq bean);

    RoomHouseReserve convert(ReserveUpdateReq bean);

    @Mapping(source = "expirationDate", target = "expirationDate", dateFormat = "yyyy-MM-dd HH:mm")
    @Mapping(source = "checkInDate", target = "checkInDate", dateFormat = "yyyy-MM-dd")
    @Mapping(source = "checkOutDate", target = "checkOutDate", dateFormat = "yyyy-MM-dd")
    @Mapping(source = "depositPaymentTerm", target = "depositPaymentTerm", dateFormat = "yyyy-MM-dd HH:mm")
    @Mapping(source = "paymentTime", target = "paymentTime", dateFormat = "yyyy-MM-dd")
    @Mapping(source = "deposit", target = "deposit", resultType = BigDecimal.class)
//    @Mapping(source = "roomHouseId", target = "roomHouseId", resultType = String.class)
    ReserveGetResp convert(RoomHouseReserve bean);

    @Mapping(source = "expirationDate", target = "expirationDate", dateFormat = "yyyy-MM-dd HH:mm")
    @Mapping(source = "checkInDate", target = "checkInDate", dateFormat = "yyyy-MM-dd")
    @Mapping(source = "checkOutDate", target = "checkOutDate", dateFormat = "yyyy-MM-dd")
    @Mapping(source = "depositPaymentTerm", target = "depositPaymentTerm", dateFormat = "yyyy-MM-dd HH:mm")
    @Mapping(source = "paymentTime", target = "paymentTime", dateFormat = "yyyy-MM-dd")
    @Mapping(source = "deposit", target = "deposit", resultType = BigDecimal.class)
//    @Mapping(source = "roomHouseId", target = "roomHouseId", resultType = String.class)
    List<ReserveGetResp> convert(List<RoomHouseReserve> bean);


    RoomReceiptRespVO convert2(RoomReceipt bean);
    PageResult<ReceiptPageRespVO> convert3(PageResult<RoomReceipt> bean);

    List<ReserveWithdrawExcelVO> convertBeanList2ExcelVOList(List<ReserveBillPageResp> beanList);
}
